import {Component, OnInit} from '@angular/core';
import {ArticleModel} from '../../models/article.model';
import {ActivatedRoute} from '@angular/router';
import {ArticleService} from '../../service/article.service';

@Component({
  selector: 'ngx-article',
  styleUrls: ['./article.component.scss'],
  templateUrl: './article.component.html',
})
export class ArticleComponent implements OnInit {

  article: ArticleModel = {};


  constructor(private activatedRoute: ActivatedRoute, private  articleService: ArticleService) {
  }

  ngOnInit(): void {
    const id = this.activatedRoute.snapshot.paramMap.get('id');
    this.articleService.getArticle(Number(id)).subscribe(res => {
      this.article = res;
    })
  }

}
